#include "WRenderer.h"

#include "Shader.h"
#include "Material.h"

#include "SceneGraph.h"
#include "SceneNode.h"
#include "RenderTexture.h"

#include "WCube.h"
#include "WLine.h"

#include "Parameter.h"

#include "TextureCubeMap.h"
#include "WIrradianceBaker.h"

#include "anttweakbar\AntTweakBar.h"

/*
**Uniform params ubo: global ubo for all the objects across the application
*/
struct GuiParams {
	glm::mat4 viewProjMat;
	glm::vec4 guiScales; //original scale xy and new scale xy
};


class WSceneRenderer : public WRenderer
{
public:
	WSceneRenderer(bool& running)
		: WRenderer(running)
	{
	}

	~WSceneRenderer()
	{
	}

	virtual void Init() override;

	/********************************************
	**			GUI components (anttweakgui)
	**********************************************/
	std::shared_ptr<TwBar> antTweakBar;							//<-- has to be public as objects add their variables to this anttweabar

protected:
	
	//initializes the scene
	void InitSkyBox();
	void InitAxis();
	void InitGUI();
	void AddTextureDisplay(float bottomLeft, float topRight, GLuint textureID);
	void InitAntTweakGUI();
	void InitIrradianceBaker();

	virtual void PollInput() override;
	virtual void Render() override;

	std::shared_ptr<TextureCubeMap> skyBox;

	std::shared_ptr<SceneNode> skyBoxNode;
	std::shared_ptr<SceneNode> axis;

	RenderTexture* renderTexture;


	/********************************************
	**			GUI components (texture)
	**********************************************/
	glm::mat4 guiMatrix;
	std::shared_ptr<SceneNode> guiNode;

	GLuint guiUBO;		//ubo, shared by all gui
	GuiParams gParams;

	bool enableTextureDisplay;

	
	/********************************************
	**			PreConvolve Texture test
	**********************************************/
	std::shared_ptr<WIrradianceBaker> irradianceBaker;

};